package com.concurrency.practise.controller;

import com.concurrency.practise.entity.User;
import com.concurrency.practise.entity.repository.UserRepository;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: currency_practise
 * @description:
 * @author: Jiliang.Lee
 * @create: 2019-12-11 18:42
 **/
@RestController
@RequestMapping("/users")
@AllArgsConstructor
public class UserController {
	private final UserRepository userRepository;

	@PostMapping
	public Long createUser(@RequestBody User user) {
		User save = userRepository.save(user);
		return save.getId();
	}
}
